﻿using System;
using System.Collections.Generic;
using System.Linq;

using System.Text;
using System.Threading.Tasks;
using Sharp.DataTransferObject;
using Sharp.Infrastructure;
using Sharp.Infrastructure.Interfaces;
using Sharp.Infrastructure.Search;

namespace Sharp.ServiceContracts
{
    /// <summary>
    /// 平台服务
    /// </summary>
    [ContractTag(Tag = ContractTagEnum.Authorize)]
    public partial interface IPlatformService : IApplicationServiceContract
    {
        #region 子系统
        /// <summary>
        /// 保存子系统
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>

        Result SaveSubSystem(SubSystemDTO model);

        /// <summary>
        /// 删除子系统
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>

        Result DeleteSubSystem(Guid[] ids);

        /// <summary>
        /// 获取子系统
        /// </summary>
        /// <returns></returns>

        SubSystemDTO GetSubSystemInfo(Guid id);
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="pf"></param>
        /// <returns></returns>

        PagedResult<SubSystemDTO> GetSubSystemPaged(PagingFeature pf);
        /// <summary>
        /// 获取接入系统
        /// </summary>
        /// <returns></returns>

        IList<SubSystemDTO> GetSubSystems();

        /// <summary>
        /// 通过ClientID获取子系统
        /// </summary>
        /// <param name="clientId"></param>
        /// <returns></returns>
        [ContractTag(Tag = ContractTagEnum.AllowAnonymous)]
        Task<SubSystemDTO> GetSubSystemByClientId(string clientId);
        #endregion

        #region MasterData
        /// <summary>
        /// 保存主数据
        /// </summary>
        /// <param name="masterData">主数据</param>
        /// <returns>操作结果</returns>

        Result SaveMasterData(MasterDataDTO masterData);

        /// <summary>
        /// 删除主数据
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>

        Result DeleteMasterData(Guid[] ids);

        /// <summary>
        /// 获取一条主数据
        /// </summary>
        /// <returns></returns>

        MasterDataDTO GetMasterDataInfo(Guid id);

        /// <summary>
        /// 获取主数据
        /// </summary>
        /// <returns></returns>

        IList<MasterDataSimpleDTO> GetMasterData();

        /// <summary>
        /// 获取主数据
        /// </summary>
        /// <param name="category">分类</param>
        /// <returns></returns>

        IList<MasterDataSimpleDTO> GetMasterDataByCategory(string category);
        /// <summary>
        /// 获取省份数据
        /// </summary>
        /// <returns></returns>

        IList<MasterDataDTO> GetProvinceData();

        /// <summary>
        /// 代码项翻译成文字项
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>

        string Code2Text(string code);

        /// <summary>
        /// 获取主数据分类
        /// </summary>
        /// <returns></returns>

        IList<MasterDataCategoryDTO> GetMasterDataSort();

        /// <summary>
        /// 获取分页
        /// </summary>
        /// <returns></returns>

        PagedResult<MasterDataDTO> MasterDataGetPaged(PagingFeature pf);
        #endregion

        #region masterData分类
        /// <summary>
        /// 保存主数据分类
        /// </summary>
        /// <param name="masterDataCategory">主数据分类</param>
        /// <returns>操作结果</returns>

        Result SaveMasterDataCategory(MasterDataCategoryDTO masterDataCategory);

        /// <summary>
        /// 删除主数据分类
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>

        Result DeleteMasterDataCategory(int[] ids);

        /// <summary>
        /// 获取一条主数据分类
        /// </summary>
        /// <returns></returns>

        MasterDataCategoryDTO GetMasterDataCategoryInfo(int id);

        /// <summary>
        /// 获取主数据分类
        /// </summary>
        /// <returns></returns>

        IList<MasterDataCategoryDTO> GetMasterDataCategory();
        #endregion

        #region OAuth配置
        /// <summary>
        /// 保存OAuth配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>

        Result SaveOAuthConfig(OAuthConfigDTO model);

        /// <summary>
        /// 删除OAuth配置
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>

        Result DeleteOAuthConfig(Guid[] ids);

        /// <summary>
        /// 获取OAuth配置
        /// </summary>
        /// <returns></returns>

        OAuthConfigDTO GetOAuthConfigInfo(Guid id);

        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="pf"></param>
        /// <returns></returns>

        PagedResult<OAuthConfigDTO> GetOAuthConfigPaged(PagingFeature pf);
        /// <summary>
        /// 获取接入系统
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [ContractTag(Tag = ContractTagEnum.AllowAnonymous)]
        IList<OAuthConfigDTO> GetOAuthConfigs();

        /// <summary>
        /// 通过ClientID获取OAuth配置
        /// </summary>
        /// <param name="clientId"></param>
        /// <returns></returns>

        OAuthConfigDTO GetOAuthConfigByClientId(string clientId);
        #endregion
    }


}
